package com.by.filter;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;

/**
 * description:
 * author:zcx
 * lenovo
 * 时间：2022.06.09.20.10
 */
public class RouteFilter extends ZuulFilter {
    @Override
    public String filterType() {
        return "pre";
    }

    @Override
    public int filterOrder() {
        return 2;
    }

    @Override
    public boolean shouldFilter() {
        return true;
    }

    @Override
    public Object run() throws ZuulException {
        RequestContext requestContext= RequestContext.getCurrentContext();
        Object o=requestContext.get("tokens");
        if(null!=o){
            System.out.println("token>>>>"+o.toString());
        }

        return null;
    }
}
